# THIS IS A LARGELY OBSOLETE RAKEFILE FROM MY TESTING

require 'fileutils'
include FileUtils

ENV['name'] ||= "examples/SoundTest.rb"

puts "Using sketch file #{ENV['name']}..."
$name = File.basename ENV['name'], ".rb"

task :jankity do
  system "jruby jankity.rb #{ENV['name']}"
end

task :default => [:jankity]


# OBSOLETE TASKS

task :clean do
  puts "Cleaning"
  rm_f "out/#{$name}*.png"
  rm_f "out/#{$name}*.avi"
end

task :avi do 
  cmd = %{mencoder "mf://out/#{$name}*.png" -mf fps=30 -o out/#{$name}.avi -ovc lavc -oac mp3lame -vf scale=640:480 -audiofile "data/assassins.mp3" -lavcopts vcodec=msmpeg4v2:vbitrate=1400}
  puts "Encoding with #{cmd}"
  system cmd
end

task :frames do
  ENV['frames'] ||= "2000"
end

task :normal do
  command = %{jruby jankity.rb #{ENV['$name']}}
  puts "Running with #{command}"
  system command
end

task :generate => [:clean, :frames, :normal, :avi]
task :debug => [:irb]



